import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import "./registerServiceWorker";
import "./plugins/element.js";
import axios from "axios";
import moment from "moment";
import {
  getRequest,
  postRequest,
  putRequest,
  deleteRequest
} from "./utils/axios-api";
axios.defaults.timeout = 30000; // 请求超时为30s
axios.defaults.withCredentials = true;
Vue.config.productionTip = false;
Vue.prototype.$http = axios;
Vue.prototype.$GET = getRequest;
Vue.prototype.$POST = postRequest;
Vue.prototype.$PUT = putRequest;
Vue.prototype.$DELETE = deleteRequest;
Vue.prototype.$moment = moment;
Vue.config.devtools = true;
axios.defaults.baseURL = process.env.NODE_ENV === "development" ? "/HOST" : "";
moment.locale("zh-cn"); //需要汉化
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
